package cn.zcx;

import java.util.ArrayList;
import java.util.List;

/**
 * description:
 * author:zcx
 * lenovo
 * 时间：2022.01.25.21.29
 */
public class Lab3 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>(List.of("java", "B", "c", "jcva", "basic", "javascript", "python", "go", "perl", "php"));
        // 没有排序
        System.out.println(list);

        // 降序
        list.sort((a, b) -> b.compareTo(a));
        System.out.println(list);

        // 升序
        list.sort((a, b) -> a.compareTo(b));
        System.out.println(list);


        //根据字符串字符的个数，按大到小排序
        list.sort((a, b) -> b.length() - a.length());
        System.out.println(list);
    }
}
